import Vue from 'vue'
import Router from 'vue-router'
import Login from '../components/Login.vue'
import SIdentify from '../components/show/SIdentify'
import Home from '../components/home/Home.vue'
import Menu from '../components/menu/Menu.vue'
import Role from '../components/role/Role.vue'
import User from '../components/user/User.vue'
import Base from '../components/base/Base.vue'
import BaseProperty from '../components/base/BaseProperty.vue'
import Property from '../components/base/Property.vue'
import BeviceList from '../components/base/BeviceList.vue'
import BeviceProperty from '../components/base/BeviceProperty.vue'
import Bevice from '../components/base/Bevice.vue'
import PatrolePlam from '../components/patrol/patrol_plan/PatrolPlan'
import RapairNot from '../components/repair/repairnot.vue'
import Checked from '../components/repair/checked.vue'
import UnChecked from '../components/repair/unchecked.vue'
import Send from '../components/repair/send.vue'
import RepairMain from '../components/repair/repairmain.vue'
import Monitoe from '../components/monitor/monitoe.vue'
import Boom from '../components/monitor/boom.vue'

import PatroleTask from '../components/patrol/patrol_task/PatrolTask'
import PatrolCheck from '../components/patrol/patrol_check/PatrolCheck'
import PatrolPoint from '../components/patrol/patrol_point/PatrolPoint'
import BaseRepair from '../components/repair/baserepair.vue'


// 解决ElementUI导航栏中的vue-router在3.0版本以上重复点菜单报错问题
const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

import buylist from '../components/buycheck/buychecklist.vue'
import addbuy from '../components/buycheck/addbuycheck.vue'
import buyback from '../components/buycheck/buyback.vue'

import pump from '../components/GMS/pump.vue'
import pumpdata from '../components/GMS/pumpdata.vue'
import map from '../components/GMS/map.vue'



Vue.use(Router)

Vue.use(SIdentify)

export default new Router({
  routes: [
    {path:'/',redirect:'/login'},

    {path:'/login',component:Login},
    {path:'/home',component:Home,
     children:[
       {path:"/system/menu",component:Menu},
       {path:"/role/manager",component:Role},
       {path:"/user/manager",component:User},
       {path:"/device/manager",component:Base,
        children:[
          {path:"/device/base/",component:BaseProperty,
           children:[
              {path:"/property/:id",component:Property}
           ]
          },
          {path:"/property/8",component:BaseProperty},
          {path:"/device/list",component:BeviceList},
          {path:"/device/property",component:BeviceProperty,
           children:[
             {path:"/device/:id",component:Bevice}
           ]
          },
        ]
       },
       {path:"/maintain/manager",component:RepairMain},
       {path:"/patrol/plan",component:PatrolePlam},
       {path:"/polling/task",component:PatroleTask},
       {path:"/worker/not",component:RapairNot},
       {path:"/worker/check",component:UnChecked},
       {path:"/worker/ischeck",component:Checked},
       {path:"/worker/yet",component:Send},
       {path:"/patrol/check",component:PatrolCheck},
       {path:"/patrol/item",component:PatrolPoint},
       {path:"/buy/list",component:buylist},
       {path:"/buy/add",component:addbuy},
       {path:"/monitor/manager",component:Monitoe,
         children:[
           {path:"/monitor/boom",component:Boom}
         ]
       },
       {path:"/buy/buyback",component:buyback},

       {path:"/gms/pump",component:pump},
       {path:"/gms/pumpdata",component:pumpdata},
       {path:"/gms/map",component:map},

       {path:"/base/repair",component:BaseRepair}

     ]
    },
  ]
})
